/*
 * transmission-remote-java remote control for transmission daemon
 *
 * Copyright (C) 2009  dvstar
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


/*
 * TorrentMetaInfo.java
 *
 * Created on 28 серп 2009, 9:57:05
 */
package net.sf.dvstar.transmission.dialogs;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import net.sf.dvstar.transmission.TransmissionApp;
import net.sf.dvstar.transmission.TransmissionView;
import net.sf.dvstar.transmission.protocol.TransmissionManager;
import net.sf.dvstar.transmission.utils.ConfigStorage;
import org.jdesktop.application.Application;
import org.jdesktop.application.ResourceMap;
import org.klomp.snark.MetaInfo;
import org.klomp.snark.bencode.BDecoder;
import org.openide.util.Exceptions;

/**
 *
 * @author dstarzhynskyi
 */
public class TorrentMetaInfo extends javax.swing.JDialog {

    private MetaInfo metaInfo = null;
    private File file = null;
    private final Logger loggerProvider;
    private boolean standalone = false;
    private ResourceMap globalResourceMap = null;
    private TransmissionManager parent;

    /** Creates new form TorrentMetaInfo */
    public TorrentMetaInfo(TransmissionManager parent, boolean modal, File file) {
        super(parent.getFrame(), modal);
        this.parent = parent;
        globalResourceMap = Application.getInstance(net.sf.dvstar.transmission.TransmissionApp.class).getContext().getResourceMap(TransmissionView.class);
        this.setIconImage(globalResourceMap.getImageIcon("MainFrame.icon").getImage());
        this.file = file;
        this.loggerProvider = parent.getGlobalLogger();
        initComponents();
        fillData();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        lbTorrentFile = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        lbTorrentName = new javax.swing.JTextArea();
        jPanel2 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        javax.swing.JLabel appVersionLabel = new javax.swing.JLabel();
        lbTorrentLength = new javax.swing.JLabel();
        lbPieces = new javax.swing.JLabel();
        lbPiecesLength = new javax.swing.JLabel();
        spFiles = new javax.swing.JScrollPane();
        jlFiles = new javax.swing.JList();
        jPanel3 = new javax.swing.JPanel();
        btClose = new javax.swing.JButton();
        lbGPLv3 = new javax.swing.JLabel();
        btClose1 = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(net.sf.dvstar.transmission.TransmissionApp.class).getContext().getResourceMap(TorrentMetaInfo.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setMinimumSize(new java.awt.Dimension(670, 400));
        setName("Form"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setPreferredSize(new java.awt.Dimension(320, 76));

        jLabel1.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        lbTorrentFile.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        lbTorrentFile.setForeground(resourceMap.getColor("lbTorrentFile.foreground")); // NOI18N
        lbTorrentFile.setText(resourceMap.getString("lbTorrentName.text")); // NOI18N
        lbTorrentFile.setName("lbTorrentFile"); // NOI18N

        jLabel6.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        lbTorrentName.setColumns(20);
        lbTorrentName.setEditable(false);
        lbTorrentName.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        lbTorrentName.setLineWrap(true);
        lbTorrentName.setRows(5);
        lbTorrentName.setText(resourceMap.getString("lbTorrentName.text")); // NOI18N
        lbTorrentName.setBorder(null);
        lbTorrentName.setDisabledTextColor(resourceMap.getColor("lbTorrentName.disabledTextColor")); // NOI18N
        lbTorrentName.setFocusable(false);
        lbTorrentName.setName("lbTorrentName"); // NOI18N
        lbTorrentName.setOpaque(false);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lbTorrentName)
                    .addComponent(lbTorrentFile, javax.swing.GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(lbTorrentName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbTorrentFile)
                    .addComponent(jLabel6))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);

        jPanel2.setMinimumSize(new java.awt.Dimension(120, 260));
        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setPreferredSize(new java.awt.Dimension(414, 260));

        jLabel7.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel2.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel4.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel10.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        appVersionLabel.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        appVersionLabel.setForeground(resourceMap.getColor("appVersionLabel.foreground")); // NOI18N
        appVersionLabel.setText(resourceMap.getString("appVersionLabel.text")); // NOI18N
        appVersionLabel.setName("appVersionLabel"); // NOI18N

        lbTorrentLength.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        lbTorrentLength.setText(resourceMap.getString("lbTorrentLength.text")); // NOI18N
        lbTorrentLength.setName("lbTorrentLength"); // NOI18N

        lbPieces.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        lbPieces.setText(resourceMap.getString("lbPieces.text")); // NOI18N
        lbPieces.setName("lbPieces"); // NOI18N

        lbPiecesLength.setFont(resourceMap.getFont("lbPiecesLength.font")); // NOI18N
        lbPiecesLength.setText(resourceMap.getString("lbPiecesLength.text")); // NOI18N
        lbPiecesLength.setName("lbPiecesLength"); // NOI18N

        spFiles.setName("spFiles"); // NOI18N

        jlFiles.setFont(resourceMap.getFont("jlFiles.font")); // NOI18N
        jlFiles.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jlFiles.setName("jlFiles"); // NOI18N
        spFiles.setViewportView(jlFiles);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(spFiles, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(28, 28, 28)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbTorrentLength, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)
                            .addComponent(appVersionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)
                            .addComponent(lbPiecesLength, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)
                            .addComponent(lbPieces, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(appVersionLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbTorrentLength))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(lbPieces))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(lbPiecesLength))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(spFiles, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
                .addContainerGap())
        );

        getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);

        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setPreferredSize(new java.awt.Dimension(400, 51));

        btClose.setText(resourceMap.getString("btClose.text")); // NOI18N
        btClose.setName("btClose"); // NOI18N
        btClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCloseActionPerformed(evt);
            }
        });

        lbGPLv3.setIcon(resourceMap.getIcon("lbGPLv3.icon")); // NOI18N
        lbGPLv3.setText(resourceMap.getString("lbGPLv3.text")); // NOI18N
        lbGPLv3.setToolTipText(resourceMap.getString("lbGPLv3.toolTipText")); // NOI18N
        lbGPLv3.setName("lbGPLv3"); // NOI18N
        lbGPLv3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lbGPLv3MouseClicked(evt);
            }
        });

        btClose1.setText(resourceMap.getString("btClose1.text")); // NOI18N
        btClose1.setName("btClose1"); // NOI18N
        btClose1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btClose1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(lbGPLv3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 360, Short.MAX_VALUE)
                .addComponent(btClose1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btClose)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbGPLv3)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btClose)
                            .addComponent(btClose1))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel3, java.awt.BorderLayout.SOUTH);

        jPanel4.setMaximumSize(new java.awt.Dimension(256, 256));
        jPanel4.setName("jPanel4"); // NOI18N
        jPanel4.setPreferredSize(new java.awt.Dimension(256, 256));
        jPanel4.setLayout(new java.awt.BorderLayout());

        jLabel3.setIcon(resourceMap.getIcon("jLabel3.icon")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setMaximumSize(new java.awt.Dimension(260, 260));
        jLabel3.setMinimumSize(new java.awt.Dimension(260, 260));
        jLabel3.setName("jLabel3"); // NOI18N
        jLabel3.setPreferredSize(new java.awt.Dimension(260, 260));
        jPanel4.add(jLabel3, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel4, java.awt.BorderLayout.WEST);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCloseActionPerformed
        this.dispose();
        if(standalone) System.exit(0);
    }//GEN-LAST:event_btCloseActionPerformed

    private void btClose1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btClose1ActionPerformed

            JDialog aboutBox = new TransmissionAboutBox( parent );
            aboutBox.setLocationRelativeTo(parent.getFrame());
            TransmissionApp.getApplication().show(aboutBox);

    }//GEN-LAST:event_btClose1ActionPerformed

    private void lbGPLv3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbGPLv3MouseClicked
            JDialog aboutBox = new TransmissionAboutBox( parent );
            aboutBox.setLocationRelativeTo(parent.getFrame());
            TransmissionApp.getApplication().show(aboutBox);
    }//GEN-LAST:event_lbGPLv3MouseClicked

    private void fillData() {

        metaInfo = null;
        InputStream ist = null;
        try {

            ist = new FileInputStream(file);
            metaInfo = new MetaInfo(new BDecoder(ist));

        } catch (FileNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        } finally {
            try {
                ist.close();
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            }
        }


        if (metaInfo != null) {





            lbTorrentName.setText(metaInfo.getName());
            lbTorrentFile.setText(file.getName());

            lbTorrentLength.setText("" + metaInfo.getTotalLength());
            lbPieces.setText("" + metaInfo.getPieces());
            lbPiecesLength.setText("" + metaInfo.getPieceLength(1));

            jlFiles.removeAll();
            DefaultListModel model = new DefaultListModel();

            if (metaInfo.getFiles() != null) {
                Iterator filesIterator = metaInfo.getFiles().iterator();
                while (filesIterator.hasNext()) {
                    model.addElement(filesIterator.next());
                }
            } else {
                model.addElement(metaInfo.getName());
            }
            jlFiles.setModel(model);

            if(loggerProvider != null){
                loggerProvider.log(Level.INFO, metaInfo.toString());
            }
        }

        //lbTorrentLength.setText(""+metaInfo.getLength());
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    javax.swing.JButton btClose;
    javax.swing.JButton btClose1;
    javax.swing.JLabel jLabel1;
    javax.swing.JLabel jLabel10;
    javax.swing.JLabel jLabel2;
    javax.swing.JLabel jLabel3;
    javax.swing.JLabel jLabel4;
    javax.swing.JLabel jLabel5;
    javax.swing.JLabel jLabel6;
    javax.swing.JLabel jLabel7;
    javax.swing.JPanel jPanel1;
    javax.swing.JPanel jPanel2;
    javax.swing.JPanel jPanel3;
    javax.swing.JPanel jPanel4;
    javax.swing.JList jlFiles;
    javax.swing.JLabel lbGPLv3;
    javax.swing.JLabel lbPieces;
    javax.swing.JLabel lbPiecesLength;
    javax.swing.JLabel lbTorrentFile;
    javax.swing.JLabel lbTorrentLength;
    javax.swing.JTextArea lbTorrentName;
    javax.swing.JScrollPane spFiles;
    // End of variables declaration//GEN-END:variables

    /**
     * @param args the command line arguments
     */
    public static void main(final String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {

                LocalTransmissionManager local = new LocalTransmissionManager();

                if (args.length == 0) {
                    JOptionPane.showMessageDialog(local.getFrame(), "Not full arguments !", "Torrent metainfo", JOptionPane.ERROR_MESSAGE);
                    System.exit(1);
                }

                File file = new File(args[0]);

                TorrentMetaInfo dialog = new TorrentMetaInfo(local, true, file);
                dialog.standalone = true;
                dialog.setLocationRelativeTo(local.getFrame());
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);

            }
        });
    }

    static class LocalTransmissionManager implements TransmissionManager {

        JFrame parent;

        public LocalTransmissionManager(){
                parent = new javax.swing.JFrame();
        }

        @Override
        public Logger getGlobalLogger() {
            return null;
        }

        @Override
        public ResourceMap getGlobalResourceMap() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ConfigStorage getGlobalConfigStorage() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public JFrame getFrame() {
            return parent;
        }

        @Override
        public Locale getDefaultLocale() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

    }

}
